<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>
    <title>命名视图</title>
</head>
<body>
<div id="app">
   <router-view class="view one"></router-view>
   <router-view class="view two" name="a"></router-view>
   <router-view class="view three" name="b"></router-view>
</div>

<script>
     Vue.component('first', {
        template: '<div>这是第一tab</div>'
    })

      Vue.component('second', {
        template: '<input type="text" />'
    })

       Vue.component('third', {
        template: '<div>这是第三tab</div>'
    })

      const vueRouter = new VueRouter({
      	routers: [
      		{
      			path: '/',
      			components: {
      				default: first,
      				a: second,
      				b: third
      			}
      		}
      	]
      })
    new Vue({
        el: '#app',
        data: function (){
            return {
                currentTabComponent: 'first'
            }
        },
        methods: {
            tab(t) {
                this.currentTabComponent = t
            }
        },
        routers: vueRouter
    })


</script>
</body>
</html>